package com.gdut.demo6;


import java.util.Comparator;
import java.util.HashMap;
import java.util.TreeSet;

public class Demo6 {
    public static void main(String[] args) {
        TreeSet<Integer> ts = new TreeSet<>();
        ts.add(5);
        ts.add(3);
        ts.add(4);
        System.out.println(ts);
        System.out.println("--------------------");
        TreeSet<Student> ts2 = new TreeSet<>(Comparator.comparingInt(o -> o.getName().length()));
        Student std1 = new Student("zhangSan", "010", 11);
        Student std2 = new Student("liSi", "010", 10);
        ts2.add(std1);
        ts2.add(std2);
        System.out.println(ts2);
        System.out.println("--------------------");
        HashMap<Student, Integer> hm = new HashMap<>();
        hm.put(std1, 12);
        hm.put(std2, 13);
        hm.forEach((std, integer) -> System.out.println(std.getName() + " " + integer));
    }
}
